package yunhe.servlet;

import yunhe.service.AdminServers;
import yunhe.service.impl.AdminServersImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@SuppressWarnings("serial")
public class AdminReg extends HttpServlet {
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		AdminServers as=new AdminServersImpl();
		String naName=request.getParameter("userName");
		String naPass=request.getParameter("pwd");
		int re=as.register(naName, naPass);
		if(re>0){
			request.getSession().setAttribute("isSucc", true);
		}
		else{
			request.getSession().setAttribute("isSucc", false);
		}
		response.sendRedirect("register.jsp");
	}
}
